import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 评论信息 */
export interface CoachComment {
          id: number; // ID
          userId?: number; // 用户ID
          coachId?: number; // 教练ID
          orderId: number; // 订单ID
          content?: string; // 评论内容
          images: string; // 评论图片
          score?: number; // 评分
          auditStatus?: number; // 审核状态（字典：business_audit_status）
          refuseCause: string; // 拒绝原因
  }

// 评论 API
export const CoachCommentApi = {
  // 查询评论分页
  getCoachCommentPage: async (params: any) => {
    return await request.get({ url: `/business/coach-comment/page`, params })
  },

  // 查询评论详情
  getCoachComment: async (id: number) => {
    return await request.get({ url: `/business/coach-comment/get?id=` + id })
  },

  // 新增评论
  createCoachComment: async (data: CoachComment) => {
    return await request.post({ url: `/business/coach-comment/create`, data })
  },

  // 修改评论
  updateCoachComment: async (data: CoachComment) => {
    return await request.put({ url: `/business/coach-comment/update`, data })
  },

  // 修改评论
  auditCoachComment: async (data: CoachComment) => {
    return await request.put({ url: `/business/coach-comment/audit`, data })
  },

  // 删除评论
  deleteCoachComment: async (id: number) => {
    return await request.delete({ url: `/business/coach-comment/delete?id=` + id })
  },

  /** 批量删除评论 */
  deleteCoachCommentList: async (ids: number[]) => {
    return await request.delete({ url: `/business/coach-comment/delete-list?ids=${ids.join(',')}` })
  },

  // 导出评论 Excel
  exportCoachComment: async (params) => {
    return await request.download({ url: `/business/coach-comment/export-excel`, params })
  },
}
